<include file="Public/head" />
<style type="text/css">
    .cheyuan1,.cheyuan2{display: block;margin-top: 15px;}
    .cheyuan2{color: #303030;float: left;margin-left: 20px;margin-bottom:15px;}
    .cheyuan2 .car_no_state{ border: 1px solid #d7d7d7;height: 22px;line-height: 22px;margin-left: 10px;text-align: center;width: 150px;}
    .create_marks{ background: #20ab4f none repeat scroll 0 0; border: medium none;border-radius: 3px;color: #fff;margin-left: 7px;padding: 0;width: 120px;}
    .cheyuan-btn{ background: #20ab4f none repeat scroll 0 0; border: medium none;border-radius: 3px;color: #fff;margin-left: 7px;padding: 0;width: 80px;height:24px;}
    .cheyuan2 select{ border: 1px solid #d7d7d7;float: left;height: 22px;line-height: 22px;text-align: center;width: 150px;margin-left: 36px; }
    .marks_manage{
        background: #fff none repeat scroll 0 0;
        border: 1px solid #20ab4f;border-radius: 3px;display: none; height: 220px;left: 50%;margin: -110px 0 0 -277px;position: fixed;top: 50%;width: 554px;
        z-index: 999999; }
    .marks_manage h3{background: #cecece none repeat scroll 0 0;border: 1px solid #ededee;
                     border-radius: 3px;color: #333;display: block;font-size: 18px;height: 38px; line-height: 38px;text-align: center;}
    .marks_manage .queding{background: #20ab4f none repeat scroll 0 0;border: medium none;border-radius: 3px;color: #fff; float: left;font-size: 14px; height: 30px;
                           line-height: 30px;margin: 0 38px;text-align: center;width: 170px;}
    .marks_manage  .quxiao{
        background: #fff none repeat scroll 0 0;border: 1px solid #20ab4f;border-radius: 3px;color: #20ab4f;float: left;
        font-size: 14px;height: 30px;line-height: 30px;text-align: center; width: 170px;}
    .marks_manage ul li{
        /*        border: 1px solid red;*/
        margin: 10px 15px;
        float:left;
    }
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar"  menu="cxgl.csgl" />

    <div class="mianR">
        <h3 class="cha">竞标拍品管理</h3>
        <div class="cheyuan1 clearfix">
            <script src="http://img2.isou365.cn/paimai/cheshan/js/model_select.js" type="text/javascript"></script>
            <select name="order_mode" id="order_mode" class="order_mode" >
                <option value="">请选择拍单状态</option>
                <?php foreach ($order_mode as $key => $value): ?>
                        <option value="{$key}">{$value}</option>
                <?php endforeach ?>
            </select>
        </div>
        <div class="cheyuan2" style="margin-bottom: 0px; ">
               <div style="float:left;width:280px">
                     <input type="text" name="start_time" placeholder="开始时间" value="{$st}" class="xiaci xin-text1 time-end" id="start_time" readonly>
                    - <input type="text" name="end_time"  placeholder="结束时间" value="{$et}" class="xiaci xin-text1 time-end" id="end_time" readonly />
                </div>  
            <select name="emission" id="emission" class="emission" style=" margin-left:10px">
                <option value="">请选择排放标准</option>
                <?php foreach ($emission as $key => $value): ?>
                    <option value="{$key}">{$value}</option>
                <?php endforeach ?>
            </select>
            <div class="source_input source_input1">
                <input type="text"  name="comefrom" value="-2" real-value= "-2" placeholder="请选择车辆来源" readOnly />
                <div class="source">
                    <ul>
                        <?php foreach($pfrom as $item):?>
                        <li date="{$item.from_id}">{$item.from_name}</li>
                        <?php endforeach;?>
                    </ul>
                </div>
                <div class="sourceCity">
                    <ul>
                        <foreach name="bc_city" item="vo" key="k">
                            <li date-city="{$k}">{$vo}</li>
                        </foreach>
                    </ul>
                </div>
                <div class="sourceTab">
                    <foreach name="comefrom_list" item="cl" key="k">
                        <div class="sourceList" date-pid="{$k}">
                            <ul>
                                <foreach name="cl" item="clv">
                                    <li date-id="{$clv.from_id}">{$clv.from_name}</li>
                                </foreach>
                            </ul>
                        </div>
                    </foreach>

                    <div class="sourceList siSdian">
                        <foreach name="city_fours_list" item="cfl" key="k">
                            <ul style="display: none;" date-code-city="{$k}">
                                <foreach name="cfl" item="cflv">
                                    <li date-id="{$cflv.from_id}">{$cflv.from_name}</li>
                                </foreach>
                            </ul>
                        </foreach>
                    </div>
                </div>
            </div>
            <input type="text" name="order_no" placeholder="拍单号" class="car_no_state"/>
<!--             <input type="button" value="搜索" name="cyxs_search" class="cheyuan-btn"  /> -->
        </div>
        <div class="cheyuan2">
             <div style="float:left;width:280px">
                 <input type="text" name="bid_start_time" placeholder="拍卖结束时间" value="" class="xiaci xin-text1 time-end" id="bid_start_time" readonly>
                - <input type="text" name="bid_end_time"  placeholder="拍卖结束时间" value="" class="xiaci xin-text1 time-end" id="bid_end_time" readonly />
            </div>
            <input type="button" value="搜索" name="cyxs_search" class="cheyuan-btn"  />
        </div>
        <div class="yunBei" style="z-index:999998"></div>
        <div class="yuList">
            <div class="listBox" id="listBox"></div>
        </div>
    </div>
    <div class="clear"></div>
    <script type="text/javascript">
        //获取url中的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null)
                return unescape(r[2]);
            return null; //返回参数值
        }
        function get_list() {
            var url = mkurl();
            var p = getUrlParam('p');
            var purl = '';
            if (p != null) {
                purl = "?p=" + p;
            } else {
                purl = "?p=1";
            }
            $.get("/CarDealer/get_dealerbidding_list/dealer_id/{$dealer_id}"+ purl, encodeURI(url), function (data) {
                $("#listBox").html(data);
            }, "html");
        }

        function get_page(p) {
            var url = mkurl();
            url += "&p=" + p;
            $.get("/CarDealer/get_dealerbidding_list/dealer_id/{$dealer_id}", encodeURI(url), function (data) {
                $("#listBox").html(data);
            }, "html");
        }
        $("input[name='cyxs_search']").on("click", function () {
            get_list();
        });
        //搜索
        function mkurl() {
            var url = "";
            var brand_id = $('.pingXiaCo').attr('brand_id');
            var series_id = $('.cheXiaCo').attr('series_id');
            var model_id = $('.cheXiaCo1').attr('model_id');
            var order_no = $("input[name='order_no']").val();
            var start_time = $('#start_time').val();
            var end_time = $('#end_time').val();
            var bid_end_time = $('#bid_end_time').val();
            var bid_start_time = $('#bid_start_time').val();
            var comefrom = $("input[name='comefrom']").attr('real-value');
            var emission = $('#emission').find("option:selected").val();
            var order_mode = $('#order_mode').find("option:selected").val();
            if (brand_id) {
                url += '&brand_id=' + brand_id;
            }
            if (series_id) {
                url += '&series_id=' + series_id;
            }
            if (model_id) {
                url += '&model_id=' + model_id;
            }
            if (order_no) {
                url += '&order_no=' + order_no;
            }
            if (start_time) {
                url += '&start_time=' + start_time;
            }
            if (end_time) {
                url += '&end_time=' + end_time;
            }
            if (comefrom) {
                url += '&comefrom=' + comefrom;
            }
            if (emission) {
                url += '&emission=' + emission;
            }
            if (order_mode) {
                url += '&order_mode=' + order_mode;
            }
            if (bid_end_time) {
                url += '&bid_end_time=' + bid_end_time;
            }
            if (bid_start_time) {
                url += '&bid_start_time=' + bid_start_time;
            }
            return url;
        }
        get_list();

        $("body,html").click(function(event) {
            $(".sourceCity").hide();
            $(".sourceTab .sourceList").hide();
            $(".source").hide();
            event.stopPropagation();
        });

        $(".source_input").click(function(event) {
            event.stopPropagation();
        });
        $(".source_input input").val("");
        $(".source_input input").click(function() {
//            $(this).val("");
            if($(".source").css("display")=="none"){
                $(".source").fadeIn();
            }else{
                $(".source").hide();
            }
            $(".sourceCity").hide();
            $(".sourceTab .sourceList").hide();
        });
        var index;
        var text;
        var dateIndex;
        $(".source ul li").click(function() {
            index=$(".source ul li").index(this);
            text=$(this).html();
            dateIndex=$(this).attr("date");
            if(dateIndex==5){
                $(".sourceCity").fadeIn();
                $(".sourceTab .sourceList").hide();
            }else{
                $(".sourceCity").hide();
                $(".sourceTab .sourceList[date-pid='"+dateIndex+"']").fadeIn().siblings().hide();
            }
            $(this).parent().parent().hide();
        });
        var city;
        var cityIndex;
        $(".sourceCity ul li").click(function(i){
            city=$(this).html();
            $(this).parent().parent().hide();
            cityIndex=$(this).attr("date-city");
            $(".sourceTab .siSdian").fadeIn().find("ul[date-code-city='"+cityIndex+"']").fadeIn().siblings().hide();
        })
        $(".sourceList ul li").click(function(){
            $(this).parent().parent().hide();
            if(index==3){
                $(".source_input input").val(text+" - "+city+" - "+$(this).html());
                $(".source_input input").attr("real-value",$(this).attr("date-id"));
            }else{
                $(".source_input input").val(text+" - "+$(this).html());
                $(".source_input input").attr("real-value",$(this).attr("date-id"));
            }
        });
        function GetDateStr(AddDayCount) {
            var dd = new Date();
            dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
            var y = dd.getFullYear();
            var m = dd.getMonth()+1;//获取当前月份的日期
            var d = dd.getDate();
            return y+"-"+m+"-"+d;
        }
        var Yesterday = GetDateStr(-1);
        $("#start_time").ymdateplugin({
            changeMonth: true,
            changeYear: true,
            maxDate:Yesterday  
        });
        $("#end_time").ymdateplugin({
            changeMonth: true,
            changeYear: true,
            maxDate:Yesterday  
        });
        $("#bid_start_time").ymdateplugin({
            changeMonth: true,
            changeYear: true
        });

        $("#bid_end_time").ymdateplugin({
            changeMonth: true,
            changeYear: true
        });
    </script>
    <include file="Public/foot" />
